/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.qinyeit.serviceapp.entity.enums.BranchPurchaseState;
import com.qinyeit.serviceapp.entity.enums.BranchPurchaseType;
import lombok.Builder;
import lombok.experimental.Tolerate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * ClassName: BranchPurchaseOrder <br/>
 * Function: 门店采购订单 <br/>
 * date: 2018-11-29 17:12:44 <br/>
 *
 * @author liuwenjin
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="branch_purchase_orders")
public class BranchPurchaseOrder extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	// 单号 
    @Column(name="no", length = 300)
	private String no = null;

	// 订单类型（自采/直配） 
    @Column(name="type", length = 300)
	@Enumerated(EnumType.STRING)
	private BranchPurchaseType type = BranchPurchaseType.ZHIPEI;

	// 采购门店id 
    @Column(name="branch_id")
	private Long branchId = null;

	// 采购门店 
    @Column(name="branch_name", length = 300)
	private String branchName = null;

	// 供应商id  单店供应商id
    @Column(name="supplier_id")
	private Long supplierId = null;

	// 供应商名称 单店供应商名称
    @Column(name="supplier_name", length = 300)
	private String supplierName = null;

	// 收货仓库 
    @Column(name="warehouse_name", length = 300)
	private String warehouseName = null;

	// 收货地址 
    @Column(name="address", length = 300)
	private String address = null;

	// 采购人 
    @Column(name="purchaser", length = 300)
	private String purchaser = null;

	// 采购日期 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="purchase_time")
	private Date purchaseTime = null;

	// 审核人 
    @Column(name="checker", length = 300)
	private String checker = null;

	// 审核日期 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="check_time")
	private Date checkTime = null;

	// 发货人 
    @Column(name="sender", length = 300)
	private String sender = null;

	// 发货时间 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="send_time")
	private Date sendTime = null;

	// 收货日期 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="accept_time")
	private Date acceptTime = null;

	// 订单金额 
    @Column(name="amount",scale=2)
	private Double amount = null;

	// 状态
	//保存订单 总部订单为审核 -- 单店订单为 总部待发货 --
	//总部订单确认发货 -- 单店为 已审核
    @Column(name="state", length = 300)
	@Enumerated(EnumType.STRING)
	private BranchPurchaseState state = null;


    @Tolerate
	public BranchPurchaseOrder() {
		
	}
    @Tolerate
	public BranchPurchaseOrder(Long id){
    	super.setId(id);
    }
	
	/**
	 * 获取单号
	 */
	public String getNo() {
		return this.no;
	}

    /**
     * 设置单号
     */
	public BranchPurchaseOrder setNo(String no) {
		this.no = no;
		return this;
	}


	/**
	 * 获取采购门店id
	 */
	public Long getBranchId() {
		return this.branchId;
	}

    /**
     * 设置采购门店id
     */
	public BranchPurchaseOrder setBranchId(Long branchId) {
		this.branchId = branchId;
		return this;
	}

	/**
	 * 获取采购门店
	 */
	public String getBranchName() {
		return this.branchName;
	}

    /**
     * 设置采购门店
     */
	public BranchPurchaseOrder setBranchName(String branchName) {
		this.branchName = branchName;
		return this;
	}

	/**
	 * 获取供应商id
	 */
	public Long getSupplierId() {
		return this.supplierId;
	}

    /**
     * 设置供应商id
     */
	public BranchPurchaseOrder setSupplierId(Long supplierId) {
		this.supplierId = supplierId;
		return this;
	}

	/**
	 * 获取供应商名称
	 */
	public String getSupplierName() {
		return this.supplierName;
	}

    /**
     * 设置供应商名称
     */
	public BranchPurchaseOrder setSupplierName(String supplierName) {
		this.supplierName = supplierName;
		return this;
	}

	/**
	 * 获取收货仓库
	 */
	public String getWarehouseName() {
		return this.warehouseName;
	}

    /**
     * 设置收货仓库
     */
	public BranchPurchaseOrder setWarehouseName(String warehouseName) {
		this.warehouseName = warehouseName;
		return this;
	}

	/**
	 * 获取收货地址
	 */
	public String getAddress() {
		return this.address;
	}

    /**
     * 设置收货地址
     */
	public BranchPurchaseOrder setAddress(String address) {
		this.address = address;
		return this;
	}

	/**
	 * 获取采购人
	 */
	public String getPurchaser() {
		return this.purchaser;
	}

    /**
     * 设置采购人
     */
	public BranchPurchaseOrder setPurchaser(String purchaser) {
		this.purchaser = purchaser;
		return this;
	}

	/**
	 * 获取采购日期
	 */
	public Date getPurchaseTime() {
		return this.purchaseTime;
	}

    /**
     * 设置采购日期
     */
	public BranchPurchaseOrder setPurchaseTime(Date purchaseTime) {
		this.purchaseTime = purchaseTime;
		return this;
	}

	/**
	 * 获取审核人
	 */
	public String getChecker() {
		return this.checker;
	}

    /**
     * 设置审核人
     */
	public BranchPurchaseOrder setChecker(String checker) {
		this.checker = checker;
		return this;
	}

	/**
	 * 获取审核日期
	 */
	public Date getCheckTime() {
		return this.checkTime;
	}

    /**
     * 设置审核日期
     */
	public BranchPurchaseOrder setCheckTime(Date checkTime) {
		this.checkTime = checkTime;
		return this;
	}

	/**
	 * 获取发货人
	 */
	public String getSender() {
		return this.sender;
	}

    /**
     * 设置发货人
     */
	public BranchPurchaseOrder setSender(String sender) {
		this.sender = sender;
		return this;
	}

	/**
	 * 获取发货时间
	 */
	public Date getSendTime() {
		return this.sendTime;
	}

    /**
     * 设置发货时间
     */
	public BranchPurchaseOrder setSendTime(Date sendTime) {
		this.sendTime = sendTime;
		return this;
	}

	/**
	 * 获取收货日期
	 */
	public Date getAcceptTime() {
		return this.acceptTime;
	}

    /**
     * 设置收货日期
     */
	public BranchPurchaseOrder setAcceptTime(Date acceptTime) {
		this.acceptTime = acceptTime;
		return this;
	}

	/**
	 * 获取订单金额
	 */
	public Double getAmount() {
		return this.amount;
	}

    /**
     * 设置订单金额
     */
	public BranchPurchaseOrder setAmount(Double amount) {
		this.amount = amount;
		return this;
	}

	public BranchPurchaseType getType() {
		return type;
	}

	public void setType(BranchPurchaseType type) {
		this.type = type;
	}

	public BranchPurchaseState getState() {
		return state;
	}

	public void setState(BranchPurchaseState state) {
		this.state = state;
	}
}
